// pages/component/share/share.js
import http from "../../../utils/http";

Component({
  /**
   * 组件的属性列表
   */
  properties: {
    showPopup:{
      type: Boolean,
      value: false,
    },
    fid:{
      type:String,
      value:""
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    showPopup:false,
    hasUserInfo:false
  },
  ready(){
    let that = this;
    wx.getSetting({
      success(res) {
        let hasUserInfo = res.authSetting["scope.userInfo"];
        if(hasUserInfo){
          that.setData({
            hasUserInfo:true
          });
        }
      }
    });
  },
  /**
   * 组件的方法列表
   */
  methods: {
    onPopClose:function () {
      this.setData({
        showPopup:false
      })
    },
    savePic:function(){
      this.triggerEvent('save', {})  // 将num通过参数的形式传递给父组件
    },
    userInfoCallback: function(event) {
      if(event.detail.errMsg == 'getUserInfo:ok'){
        let that = this;
        http.oauthLogin(event, data => {
          that.setData({
            hasUserInfo:true
          });
          this.triggerEvent('save', {})  // 将num通过参数的形式传递给父组件
        });
      }
    },
    toCopy:function(){
      console.log("this.properties",this.properties);
      wx.navigateTo({
        url: "/pages/copyid/copyid?fid="+ this.properties.fid
      });
    }
  }
});
